﻿<Window x:Class="UndoRedoFramework.Prototype.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:UndoRedoFramework.Prototype"
	    Height="350" Width="525" WindowStyle="ToolWindow" Title="UndoRedoFramework.Prototype">
    <Window.DataContext>
        <local:MainWindowViewModel />
    </Window.DataContext>
    <Window.Resources>
		<Style TargetType="{x:Type Path}">
			<Style.Triggers>
				<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=RepeatButton}, Path=IsEnabled}" Value="true" >
					<Setter Property="Path.Opacity" Value="1" />
				</DataTrigger>
			</Style.Triggers>
			<Setter Property="Path.Opacity" Value="0.3" />
		</Style>
	</Window.Resources>
    <DockPanel>
        
        <ToolBar DockPanel.Dock="Top">
			<RepeatButton Command="{Binding Path=UndoCommand}">
				<StackPanel>
					<Viewbox Width="16" Height="16">
						<Path Data="{StaticResource LeftArrow}" Width="8" Height="10" Stretch="Fill" Fill="{StaticResource {x:Static SystemColors.InactiveCaptionTextBrushKey}}" />
					</Viewbox>
					<TextBlock Text="Undo" />
				</StackPanel>
			</RepeatButton>
			<RepeatButton Command="{Binding RedoCommand}">
				<StackPanel>
					<Viewbox Width="16" Height="16">
						<Path Data="{StaticResource RightArrow}" Width="8" Height="10" Fill="{StaticResource {x:Static SystemColors.InactiveCaptionTextBrushKey}}" Stretch="Fill" />
					</Viewbox>
					<TextBlock Text="Redo" />
				</StackPanel>
			</RepeatButton>
		</ToolBar>
        <TextBlock Foreground="Black" DockPanel.Dock="Top" ForceCursor="False" FontSize="24" TextAlignment="Center">
            <TextBlock.Text>
                <MultiBinding StringFormat="{}Entry:{0} Slider:{1} Slider2:{2} Arbitrary:{3}">
        			<Binding Path="SomeText" />
        			<Binding Path="SliderText" />
                    <Binding Path="SliderText2" />
                    <Binding Path="ArbitraryText" />
    		    </MultiBinding>
            </TextBlock.Text>
        </TextBlock>
        <StackPanel DockPanel.Dock="Bottom">
			<Slider Value="{Binding SliderText}"/>
            <Slider Value="{Binding SliderText2}" />
            <TextBox Text="{Binding ArbitraryText, UpdateSourceTrigger=PropertyChanged}"  />
		</StackPanel>
		<Grid>
			<Grid.RowDefinitions>
				<RowDefinition />
				<RowDefinition />
				<RowDefinition />
			</Grid.RowDefinitions>
			<Grid.ColumnDefinitions>
				<ColumnDefinition/>
				<ColumnDefinition/>
				<ColumnDefinition/>
				<ColumnDefinition/>
			</Grid.ColumnDefinitions>
			<Button Grid.Row="0" Grid.Column="0" Command="{Binding TypeCharacterCommand}" CommandParameter="1" Content="1"/>
			<Button Grid.Row="0" Grid.Column="1" Command="{Binding TypeCharacterCommand}" CommandParameter="2" Content="2"/>
			<Button Grid.Row="0" Grid.Column="2" Command="{Binding TypeCharacterCommand}" CommandParameter="3" Content="3"/>
			<Button Grid.Row="1" Grid.Column="0" Command="{Binding TypeCharacterCommand}" CommandParameter="4" Content="4"/>
			<Button Grid.Row="1" Grid.Column="1" Command="{Binding TypeCharacterCommand}" CommandParameter="5" Content="5"/>
			<Button Grid.Row="1" Grid.Column="2" Command="{Binding TypeCharacterCommand}" CommandParameter="6" Content="6" />
			<Button Grid.Row="2" Grid.Column="0" Command="{Binding TypeCharacterCommand}" CommandParameter="7"  Content="7" />
			<Button Grid.Row="2" Grid.Column="1" Command="{Binding TypeCharacterCommand}" CommandParameter="8" Content="8" />
			<Button Grid.Row="2" Grid.Column="2" Command="{Binding TypeCharacterCommand}" CommandParameter="9" Content="9" />
			<RepeatButton Grid.Column="3" Command="{Binding BackspaceCommand}">
				<Viewbox Margin="12">
					<Path Data="{StaticResource LeftArrow}" Width="8" Height="10" Fill="{StaticResource {x:Static SystemColors.InactiveCaptionTextBrushKey}}" Stretch="Fill" />
				</Viewbox>
			</RepeatButton>
		</Grid>
	</DockPanel>
</Window>